package com.wgz.ssm.service.impl;

import com.wgz.ssm.bean.Dept;
import com.wgz.ssm.mapper.DeptMapper;
import com.wgz.ssm.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wgz
 * Created by admin on 2021/3/30
 */
@Service
@Transactional
public class DeptServiceImpl implements DeptService {
    @Autowired
    DeptMapper deptMapper;
    public List<Dept> findAllDept() {
        return deptMapper.selectByExample(null);
    }

    public void insert(Dept dept) {
        deptMapper.insertSelective(dept);
    }

    public Dept findDeptById(Integer deptId) {
        return deptMapper.selectByPrimaryKey(deptId);
    }

    public void updateDept(Dept dept) {
        deptMapper.updateByPrimaryKeySelective(dept);
    }

    public void delDept(Integer id) {
        deptMapper.deleteByPrimaryKey(id);
    }
}
